<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Banner
 *
 * @property int $id
 * @property int $type 类型:0=首页轮播,1=商城轮播
 * @property string|null $image 轮播图片
 * @property int $sort 排序
 * @property int $status 状态:0=正常,1=隐藏
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|Banner newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Banner newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Banner query()
 * @method static \Illuminate\Database\Eloquent\Builder|Banner whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Banner whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Banner whereImage($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Banner whereSort($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Banner whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Banner whereUpdatedAt($value)
 * @mixin \Eloquent
 * @method static \Illuminate\Database\Eloquent\Builder|Banner whereType($value)
 * @property string|null $jump 跳转设置
 * @method static \Illuminate\Database\Eloquent\Builder|Banner whereJump($value)
 */
class Banner extends Model
{
	use HasDateTimeFormatter;

    public static function getList($type = 0): Collection|array
    {
        return self::query()->where("type",$type)->where("status",0)->orderByDesc("sort")->get(['id','image','jump']);
    }

    public static array $jumpList = [
        "not"=>"不跳转",
        "service"=>"服务预约",
        "shop"=>"商城中心"
    ];

}
